home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
526-550
/
disk_549
/
ffex
/
source
/
arpreq.mod
< prev
next >
Wrap
Text File
|
1992-05-06
|
2KB
|
81 lines
IMPLEMENTATION MODULE ArpReq;
FROM Exec IMPORT OpenLibrary,CloseLibrary,LibraryPtr,CopyMem;
FROM Intuition IMPORT WindowPtr,NewWindow;
FROM Arts IMPORT Assert,TermProcedure;
FROM SYSTEM IMPORT SETREG,ADDRESS,BYTE,ADR;
FROM Str IMPORT Length,Concat,Copy;
FROM FileNames IMPORT GetPath,MakeFileName;
TYPE
FileRequester=RECORD
hail : ADDRESS;
file : ADDRESS;
dir : ADDRESS;
window : WindowPtr;
funcFlags: BYTE;
reserved1: BYTE;
function : ADDRESS;
reserved2: LONGINT;
END;
VAR
req : FileRequester;
arpbase: LibraryPtr;
ok : LONGINT;
ledge : INTEGER;
PROCEDURE Cleanup;
BEGIN
IF arpbase#NIL THEN CloseLibrary(arpbase);arpbase:=NIL END;
END Cleanup;
PROCEDURE NewWin(obj:ADDRESS;mask:LONGINT);
(* $P- Parameter nicht abbauen, daß macht ARP !!! *)
VAR nw:POINTER TO NewWindow;
BEGIN
nw:=obj;nw^.leftEdge:=ledge;
END NewWin;
PROCEDURE FileRequest(req{8}:ADDRESS):LONGINT; CODE -294;
PROCEDURE GetFileName(w:WindowPtr;title,path:ADDRESS):BOOLEAN;
VAR
req: FileRequester;
p,f: ARRAY[0..255] OF CHAR;
len: INTEGER;
BEGIN
CopyMem(path,ADR(f),256);
GetPath(f,p,len); (* f in Filenamen und Pfad zerlegen *)
IF (Length(p)#0) &
(p[Length(p)-1]="/") THEN
p[Length(p)-1]:=CHAR(0); (* abschließendes '/' entfernen *)
END;
ledge:=(w^.width-300)/2;
WITH req DO
hail:=title;file:=ADR(f);dir :=ADR(p);window:=w;
funcFlags:=8;function:=ADR(NewWin);
reserved1:=0;reserved2:=0;
END;
SETREG(14,arpbase); (* <=> move.l arpbase,a6 *)
ok:=FileRequest(ADR(req));
IF ok#0 THEN
IF (Length(p)#0) &
(p[Length(p)-1]#":") THEN
Concat(p,"/")
END;
IF Length(f)#0 THEN Concat(p,f) END;
CopyMem(ADR(p),path,256);
RETURN TRUE;
ELSE
RETURN FALSE
END
END GetFileName;
BEGIN
TermProcedure(Cleanup);
arpbase:=OpenLibrary(ADR("arp.library"),0);
Assert(arpbase#NIL,ADR("arp.library required!"));
END ArpReq.mod